hash-table: simplify integer hashing
authorØyvind Kolås <pippin@gimp.org>
Sat, 31 Dec 2016 18:15:29 +0000 (19:15 +0100)
committerØyvind Kolås <pippin@gimp.org>
Sat, 31 Dec 2016 18:15:29 +0000 (19:15 +0100)
babl/babl-hash-table.c

index d507cb228141d19264e52983cb4103aabf53e7e5..e1c2e56088dede1485eae17cc2c0d4ab08a3b49b 100644 (file)
@@ -58,15 +58,11 @@ babl_hash_by_int (BablHashTable *htab,
                   int           id)
 {
   int   hash = 0;
-  int   i;
-
-  for (i = 0; i < sizeof (int); i++)
-  {
-    hash +=  id & 0xFF;
-    hash += (hash << 10);
-    hash ^= (hash >> 6);
-    id >>= 8;
-  }
+  hash +=  id & 0xFF;
+  hash += (hash << 10);
+  hash ^= (hash >> 6);
+  id >>= 8;
+  hash +=  id & 0xFF;
   hash += (hash << 3);
   hash ^= (hash >> 11);
   hash += (hash << 15);